import React, { FunctionComponent } from "react";
import { AppProps } from "next/app";
import "core-js/stable";
import "regenerator-runtime/runtime";
import openapi from "@anyshare/openapi";
import "../style/index.less";
import AntdConfigProvider from "antd/lib/config-provider";

if (process.browser) {
    openapi.defaults.https = location.protocol === "https:";
    openapi.defaults.hostname = location.hostname;
    openapi.defaults.port = parseInt(location.port, 10) || undefined;
}

const App: FunctionComponent<AppProps> = ({ Component, pageProps }) => {
    return (
        <AntdConfigProvider autoInsertSpaceInButton={false}>
            <Component {...pageProps} />
        </AntdConfigProvider>
    );
};

export default App;
